home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / text / mac / faqs.162 < prev    next >
Encoding:
Text File  |  1996-02-12  |  27.8 KB  |  710 lines

  1. Frequently Asked Questions (FAQS);faqs.162
  2.  
  3.  
  4.  
  5. The Apple IIgs records raw data in the same format as the Mac, but
  6. uses a 0 byte as a terminator; samples with value 0 are replaced by 1.
  7.  
  8.  
  9. File conversions
  10. ----------------
  11.  
  12.     SOX
  13.     ---
  14.  
  15. The most versatile tool for converting between various audio formats
  16. is SOX ("Sound Exchange").  It can read and write various types of
  17. audio files, and optionally applies some special effects (e.g. echo,
  18. channel averaging, or rate conversion).
  19.  
  20. SOX recognizes all filename extensions listed above except ".snd",
  21. which would be ambiguous anyway, and ".wav" (but there's a patch, see
  22. below).  Use type ".au" for NeXT ".snd" files.  Mac and PC ".snd"
  23. files are completely described by these parameters:
  24.  
  25.       -t raw -b -u -r 11000
  26.  
  27. (or -r 22000 or -r 7333 or -r 5500; 11000 seems to be the most common
  28. rate).
  29.  
  30. The source for SOX, version 5, was posted to alt.sources, and should
  31. be widely archived.  To save you the trouble of hunting it down, it
  32. can be gotten by anonymous ftp from wuarchive.wustl.edu, in the
  33. directory usenet/alt.sources/articles, files 5581.Z through 5585.Z.
  34. (These files are compressed news articles containing shar files, if
  35. you hadn't guessed.)  I am sure many sites have similar archives, I'm
  36. just listing one that I know of and which carries a lot of this kind
  37. of stuff.  (Also see the appendix if you don't have Internet access.)
  38.  
  39. A compressed tar file containing the same version of SOX is available
  40. by anonymous ftp from ftp.cwi.nl [192.16.184.180], in /pub/sox*.tar.Z.
  41. You may be able to locate a nearer version using archie!
  42.  
  43. Ports of SOX:
  44.  
  45. - The source as posted should compile on any UNIX system with 4-byte
  46.   integers.
  47.  
  48. - A PC version is available by ftp from ftp.cwi.nl (see above) as
  49.   pub/sox4*.zip; also available from the garbo mail server.
  50.  
  51. - The latest Amiga SOX (corresponding to version 5) is available via
  52.   anonymous ftp to wuarchive.wustl.edu, files
  53.   systems/amiga/audio/utils/amisox*.  (See below for a non-SOX
  54.   solution.)
  55.  
  56. - Work is currently in progress to get SOX ported to VMS (watch
  57.   comp.os.vms for announcements).
  58.  
  59. SOX usage hints:
  60.  
  61. - Often, the filename extension of sound files posted on the net is
  62.   wrong.  Don't give up, try a few other possibilities using the
  63.   "-t <type>" option.  Remember that the most common file type is
  64.   unsigned bytes, which can be indicated with "-t ub".  You'll have to
  65.   guess the proper sampling rate, but often it's 11k or 22k.
  66.  
  67. - In particular, with SOX version 4 (or earlier), you have to
  68.   specify "-t 8svx" for files with an .iff extension.
  69.  
  70. - When converting linear samples to U-LAW using the .au type for the
  71.   output file, you must specify "-U" for the output file, otherwise
  72.   you will end up with a file containing a NeXT/Sun header but linear
  73.   samples -- only the NeXT will play such files correctly.  Also, you
  74.   must explicitly specify an output sampling rate with "-r 8000".
  75.   (This may seem fixed for most cases in version 5, but it is still
  76.   occasionally necessary, so I'm keeping this warning in.)
  77.  
  78.         Sun Sparc
  79.         ---------
  80.  
  81. On Sun Sparcs, starting at SunOS 4.1, a program "raw2audio" is
  82. provided by Sun (in /usr/demo/SOUND -- see below) which takes a raw
  83. U-LAW file and turns it into a ".au" file by prefixing it with an
  84. appropriate header.
  85.  
  86.         NeXT
  87.         ----
  88.  
  89. On NeXTs, you can usually rename .au files to .snd and it'll work like
  90. a charm, but some .au files lack header info that the NeXT needs.
  91. This can be fixed by using sndconvert:
  92.  
  93.         sndconvert -c 1 -f 1 -s 8012.8210513 -o nextfile.snd sunfile.au
  94.  
  95.         SGI Indigo and Personal IRIS
  96.         ----------------------------
  97.  
  98. SGI supports a program sfconvert, similar in spirit to SOX (in
  99. /usr/sbin in IRIX version 4.0).  Also note that the sfplay program
  100. (see the next section) can do on-the-fly conversion for several
  101. popular formats.
  102.  
  103.         Amiga
  104.         -----
  105.  
  106. Mike Cramer's SoundZAP can do no effects except rate change and it
  107. only does conversions to IFF, but it is generally much faster than
  108. SOX.  (Ftp'able from the same directory as amisox above.)
  109.  
  110.         Tandy
  111.         -----
  112.  
  113. The Tandy 1000 uses a (proprietary?) compressed format.  There is a
  114. PD Mac to Tandy conversion program called CONVERT.
  115.  
  116.  
  117. Playing audio files on UNIX
  118. ---------------------------
  119.  
  120. The commands needed to play an audio file depend on the file format
  121. and the available hardware and software.  Most systems can only
  122. directly play sound in their native format; use a conversion program
  123. (see above) to play other formats.
  124.  
  125.         Sun Sparcstation running SunOS 4.x
  126.         ----------------------------------
  127.  
  128. Raw U-LAW files can be played using "cat file >/dev/audio".
  129.  
  130. A whole package for dealing with ".au" files is provided by Sun on an
  131. experimental basis, in /usr/demo/SOUND.  You may have to compile the
  132. programs first.  (If you can't find this directory, either you are not
  133. running SunOS 4.1 yet, or your system administrator hasn't installed
  134. it -- go ask him for it, not me!)  The program "play" in this
  135. directory recognizes all files in Sun/NeXT format, but a SS 1 or 2 can
  136. play only those using U-LAW encoding at 8 k -- the SS 10 hardware
  137. plays other encodings, too.
  138.  
  139. If you ca't find "play", you can also cat a ".au" file to /dev/audio,
  140. if it uses U-LAW; the header will sound like a short burst of noise
  141. but the rest of the data will sound OK (really, the only difference in
  142. this case between raw U-LAW and ".au" files is the header; the U-LAW
  143. data is exactly the same).
  144.  
  145. Finally, OpenWindows 3.0 has a full-fledged audio tool.  You can drop
  146. audio file icons into it, edit them, etc.
  147.  
  148.         Sun Sparcstation running Solaris 2.0
  149.         ------------------------------------
  150.  
  151. Under SVR4 (and hence Solaris 2.0), writing to /dev/audio from the
  152. shell is a bad idea, because the device driver will flush its queue as
  153. soon as the file is closed.  Use "audioplay" instead.  The supported
  154. formats and sampling rates are the same as above.
  155.  
  156.         NeXT
  157.         ----
  158.  
  159. On NeXT machines, the standard "sndplay" program can play all NeXT
  160. format files (this include Sun ".au" files).  It supports at least
  161. U-LAW at 8 k and 16 bits samples at 22 or 44.1 k.  It attempts
  162. on-the-fly conversions for other formats.
  163.  
  164. Sound files are also played if you double-click on them in the file
  165. browser.
  166.  
  167.         SGI Indigo and Personal IRIS
  168.         ----------------------------
  169.  
  170. On SGI Indigo and the 4D/30 and /35 Personal IRIS workstations, the
  171. program "sfplay" (in /usr/sbin) plays AIFF files, if the sampling rate
  172. is one of 8000, 11025, 16000, 22050, 32000, 44100, or 48000.  On the
  173. Personal IRIS, you need to have the audio board installed (check the
  174. output from hinv) and you must run IRIX 3.3.2 or 4.0 or higher.
  175. "Workspace" plays audio files if you double click on them.
  176.  
  177. There is no simple /dev/audio interface on these SGI machines.  (There
  178. was one on 4D/25 machines, reading and writing signed linear 8-bit
  179. samples at rates of 8, 16 and 32 k.)
  180.  
  181. A program "playulaw" was posted as part of the "radio 2.0" release
  182. that I posted to several source groups recently; it plays raw U-LAW
  183. files on the Indigo or Personal IRIS audio hardware.
  184.  
  185.         Sony NEWS
  186.         ---------
  187.  
  188. The Sony RISC-NEWS line (NWS-3250 laptop, NWS-37xx desktop, NWS-38xx
  189. desktop w/ IOP) also has builtin sound capabilities.  You can also buy
  190. external boards for the older NEWS machines or to add extra channels
  191. to the new machines.  In the default mode (8k/8-bit), Sun .au files
  192. are directly supported (you can 'cat' .au files to /dev/sb and have
  193. them play).
  194.  
  195.         Vaxstation 4000
  196.         ---------------
  197.  
  198. ".au" files can be played by COPYING them to device "SOA0:".  This
  199. device is set up by enabling the driver SODRIVER, as described below:
  200.  
  201. DEC's sound stuff is like most other new toy.  Hardware first, THEN the
  202. software.   DEC will soon be releasing a layered product called DECsound,
  203. which will let you record, play, and (possibly) manipulate sound files.
  204. Third party product(s) have ALREADY hit the market.
  205.  
  206. Enabling SODRIVER:   (you can use the following command file)
  207.  
  208. $!---------------- cut here -------------------------------
  209. $! sound_setup.com    enable SOUND driver
  210. $ run sys$system:sysgen
  211. connect soa0 /adapter=0 /csr=%x0e00 /vector=%o304 /driver=sodriver
  212. exit
  213. $ exit
  214. $!----------------- cut here ------------------------------------
  215.  
  216. The external audio port comes with a telephone-jack-like port.   For
  217. starters, you can plug a telephone RECEIVER right into this port to
  218. hear your first sound files.   After that, you can use the adapter
  219. (that came with the VaxStation), and plug in a small set of stereo
  220. speakers (the kind you'd plug into a WALKMAN, for example), for more
  221. volume.
  222.  
  223.         Others
  224.         ------
  225.  
  226. Most other UNIX boxes don't have audio hardware and thus can't play
  227. audio data.
  228.  
  229.  
  230. Playing audio files on micros
  231. -----------------------------
  232.  
  233. Most micros have at least a speaker built in, so theoretically all you
  234. need is the right software.  Unfortunately most systems don't come
  235. bundled with sound-playing software, so there are many public domain
  236. or shareware software packages, each with their own bugs and features.
  237. Most separate sound recording hardware also comes with playing
  238. software, most of which can play sound (in the file format used by
  239. that hardware) even on machines that don't have that hardware
  240. installed.
  241.  
  242. Chris S. Craig announces the following software for PCs:
  243.  
  244. ScopeTrax       This is a complete PC sound player/editor package.  Sounds
  245.                 can be played back at ANY rate between 1kHz to 65kHz through
  246.                 the PC speaker or the Sound Blaster.  It supports several
  247.                 file formats including VOC, IFF/8SVX, raw signed and raw
  248.                 unsigned.  A separate executable is provided to convert
  249.                 .au and mu-law to raw format.  ScopeTrax requires EGA/VGA
  250.                 graphics for editing and displaying sounds on a REALTIME
  251.                 oscilloscope.  The package also includes:
  252.                       * An expanded memory player which can play sounds
  253.                         larger than 640K in size.
  254.                       * Basic (rough) sound compression/uncompression
  255.                         utilities.
  256.                       * Complete documentation.
  257.                 The package is FREEWARE!  It is available on SIMTEL in the
  258.                 PD1:[MSDOS.SOUND] directory.
  259.  
  260. One of the appendices below contains a list of more programs to play
  261. sound on the PC.
  262.  
  263. For sounds on Atari STs - programs are in the atari/sound/players
  264. directory on atari.archive.umich.edu (141.211.164.8).
  265.  
  266. Malcolm Slaney from Apple writes:
  267.  
  268.  "We do have tools to play sound back on most of our Unix hosts.  We wrote
  269.  a program called TcpPlay that lets us read a sound file on a Unix host,
  270.  open a TCP/IP connection to the Mac on my desk, and plays the file.  We
  271.  think of it as X windows for sound (at least a step in that direction.)
  272.  
  273.  This software is available for anonymous FTP from ftp.apple.com.
  274.  Look for  ~ftp/pub/TcpPlay/TcpPlay.sit.hqx.
  275.  
  276.  Finally, there are MANY tools for working with sound on the Macintosh. Three
  277.  applications that come to mind immediately are SoundEdit (formerly by
  278.  Farralon and now by MacroMind/Paracomp), Alchemy and Eric Keller's Signalyze.
  279.  There are lots of other tools available for sound editing (including some
  280.  of the QuickTime Movie tools.)"
  281.  
  282. On a Tandy 1000, sounds can be played and recorded with DeskMate Sound
  283. (SOUND.PDM), or if they not stored in compressed format, they can also
  284. be played be a program called PLAYSND.  No indication of whether
  285. PLAYSND is PD or not. It hasn't been updated since March of 89.
  286.  
  287. The Sound Site Newsletter
  288. -------------------------
  289.  
  290. An electronic publication with lots of info about digitised sound and
  291. sound formats, albeit mostly on micros, is "The Sound Site
  292. Newsletter".  So far, 8 issues have appeared, the last in January
  293. 1992.  Issues can be ftp'ed from saffron.inset.com, directory
  294. directory pub/rogue/newsletters, or from ccb.ucsf.edu,
  295. Pub/Sound_list/Sound.Newsletters.
  296.  
  297.  
  298. Posting sounds
  299. --------------
  300.  
  301. The newsgroup alt.binaries.sounds.misc is dedicated to postings
  302. containing sound.  (Discussions related to such postings belong in
  303. alt.binaries.sounds.d.)
  304.  
  305. There is no set standard for posting sounds; uuencoded files in most
  306. popular formats are welcome, if split in parts under 50 kBytes.  To
  307. accomodate automatic decoding software (such as the ":decode" command
  308. of the nn newsreader), please place a part indicator of the form
  309. (mm/nn) at the end of your subject meaning this is number mm of a
  310. total of nn part.
  311.  
  312. It is recommended to post sounds in the format that was used for the
  313. original recording; conversions to other formats often lose
  314. information and would do people with identical hardware as the poster
  315. no favor.  For instance, convering 8-bit linear sound to U-LAW loses
  316. the lower few bits of the data, and rate changing conversions almost
  317. always add noise.  Converting from U-LAW to linear requires expansion
  318. to 16 bit samples if no information loss is allowed!
  319.  
  320. U-LAW data is best posted with a NeXT/Sun header.
  321.  
  322. If you have to post a file in a headerless format (usually 8-bit
  323. linear, like ".snd"), please add a description giving at least the
  324. sampling rate and whether the bytes are signed (zero at 0) or unsigned
  325. (zero at 0200).  However, it is highly recommended to add a header
  326. that indicates the sampling rate and encoding scheme; if necessary you
  327. can use SOX to add a header of your choice to raw data.
  328.  
  329. Compression of sound files usually isn't worth it; the standard
  330. "compress" algorithm doesn't save much when applied to sound data
  331. (typically at most 10-20 percent), and compression algorithms
  332. specifically designed for sound (e.g. NeXT's) are usually
  333. proprietary.  (See also the section "Compression schemes" earlier.)
  334.  
  335.  
  336. Appendices
  337. ==========
  338.  
  339. Here are some more detailed pieces of info that I received by e-mail.
  340. They are reproduced here virtually without much editing.
  341.  
  342. ------------------------------------------------------------------------
  343. FTP access for non-internet sites
  344. ---------------------------------
  345.  
  346. From the sci.space FAQ:
  347.  
  348.     Sites not connected to the Internet cannot use FTP directly, but
  349.     there are a few automated FTP servers which operate via email.
  350.     Send mail containing only the word HELP to ftpmail@decwrl.dec.com
  351.     or bitftp@pucc.princeton.edu, and the servers will send you
  352.     instructions on how to make requests
  353.  
  354. Also:
  355.  
  356.     FAQ lists are available by anonymous FTP from pit-manager.mit.edu
  357.     (18.72.1.58) and by email from mail-server@pit-manager.mit.edu (send
  358.     a message containing "help" for instructions about the mail server).
  359.  
  360.  
  361. ------------------------------------------------------------------------
  362. AIFF Format (Audio IFF) and AIFC
  363. --------------------------------
  364.  
  365. This format was developed by Apple for storing high-quality sampled
  366. sound and musical instrument info; it is also used by SGI and several
  367. professional audio packages (sorry, I know no names).  An extension,
  368. called AIFC or AIFF-C, supports compression (see the last item below).
  369.  
  370. I've made a BinHex'ed MacWrite version of the AIFF spec (no idea if
  371. it's the same text as mentioned below) available by anonymous ftp from
  372. ftp.cwi.nl [192.16.184.180]; the file is /pub/AudioIFF1.2.hqx.  But
  373. you may be better off with the AIFF-C specs, see below.
  374.  
  375. Mike Brindley (brindley@ece.orst.edu) writes:
  376.  
  377. "The complete AIFF spec by Steve Milne, Matt Deatherage (Apple) is
  378. available in 'AMIGA ROM Kernal Reference Manual: Devices (3rd Edition)'
  379. 1991 by Commodore-Amiga, Inc.; Addison-Wesley Publishing Co.;
  380. ISBN 0-201-56775-X, starting on page 435 (this edition has a charcoal
  381. grey cover).  It is available in most bookstores, and soon in many
  382. good librairies."
  383.  
  384. Finally, Mark Callow writes (in comp.sys.sgi):
  385.  
  386. "I have placed a PostScript version of the AIFF-C specification on
  387. sgi.sgi.com for public ftp.  It is in the file sgi/aiff-c.9.26.91.ps.
  388.  
  389. sgi.sgi.com's internet host number is (I think) 192.48.153.1."
  390.  
  391. ------------------------------------------------------------------------
  392. The NeXT/Sun audio file format
  393. ------------------------------
  394.  
  395. Here's the complete story on the file format, from the NeXT
  396. documentation.  (Note that the "magic" number is ((int)0x2e736e64),
  397. which equals ".snd".)  Also, at the end, I've added a litte document
  398. that someone posted to the net a couple of years ago, that describes
  399. the format in a bit-by-bit fashion rather than from C.
  400.  
  401. I received this from Doug Keislar, NeXT Computer.  This is also the
  402. Sun format, except that Sun doesn't recognize as many format codes.  I
  403. added the numeric codes to the table of formats and sorted it.
  404.  
  405.  
  406. SNDSoundStruct:  How a NeXT Computer Represents Sound
  407.  
  408. The NeXT sound software defines the SNDSoundStruct structure to
  409. represent sound.  This structure defines the soundfile and Mach-O
  410. sound segment formats and the sound pasteboard type.  It's also used
  411. to describe sounds in Interface Builder.  In addition, each instance
  412. of the Sound Kit's Sound class encapsulates a SNDSoundStruct and
  413. provides methods to access and modify its attributes.
  414.  
  415. Basic sound operations, such as playing, recording, and cut-and-paste
  416. editing, are most easily performed by a Sound object.  In many cases,
  417. the Sound Kit obviates the need for in-depth understanding of the
  418. SNDSoundStruct architecture.  For example, if you simply want to
  419. incorporate sound effects into an application, or to provide a simple
  420. graphic sound editor (such as the one in the Mail application), you
  421. needn't be aware of the details of the SNDSoundStruct.  However, if
  422. you want to closely examine or manipulate sound data you should be
  423. familiar with this structure.
  424.  
  425. The SNDSoundStruct contains a header, information that describes the
  426. attributes of a sound, followed by the data (usually samples) that
  427. represents the sound.  The structure is defined (in
  428. sound/soundstruct.h) as:
  429.  
  430. typedef struct {
  431.     int magic;               /* magic number SND_MAGIC */
  432.     int dataLocation;        /* offset or pointer to the data */
  433.     int dataSize;            /* number of bytes of data */
  434.     int dataFormat;          /* the data format code */
  435.     int samplingRate;        /* the sampling rate */
  436.     int channelCount;        /* the number of channels */
  437.     char info[4];            /* optional text information */
  438. } SNDSoundStruct;
  439.  
  440.  
  441.  
  442.  
  443. SNDSoundStruct Fields
  444.  
  445.  
  446.  
  447. magic
  448.  
  449. magic is a magic number that's used to identify the structure as a
  450. SNDSoundStruct.  Keep in mind that the structure also defines the
  451. soundfile and Mach-O sound segment formats, so the magic number is
  452. also used to identify these entities as containing a sound.
  453.  
  454.  
  455.  
  456.  
  457.  
  458. dataLocation
  459.  
  460. It was mentioned above that the SNDSoundStruct contains a header
  461. followed by sound data.  In reality, the structure only contains the
  462. header; the data itself is external to, although usually contiguous
  463. with, the structure.  (Nonetheless, it's often useful to speak of the
  464. SNDSoundStruct as the header and the data.)  dataLocation is used to
  465. point to the data.  Usually, this value is an offset (in bytes) from
  466. the beginning of the SNDSoundStruct to the first byte of sound data.
  467. The data, in this case, immediately follows the structure, so
  468. dataLocation can also be thought of as the size of the structure's
  469. header.  The other use of dataLocation, as an address that locates
  470. data that isn't contiguous with the structure, is described in
  471. "Format Codes," below.
  472.  
  473.  
  474.  
  475.  
  476.  
  477. dataSize, dataFormat, samplingRate, and channelCount
  478.  
  479. These fields describe the sound data.
  480.  
  481. dataSize is its size in bytes (not including the size of the
  482. SNDSoundStruct).
  483.  
  484. dataFormat is a code that identifies the type of sound.  For sampled
  485. sounds, this is the quantization format.  However, the data can also
  486. be instructions for synthesizing a sound on the DSP.  The codes are
  487. listed and explained in "Format Codes," below.
  488.  
  489. samplingRate is the sampling rate (if the data is samples).  Three
  490. sampling rates, represented as integer constants, are supported by
  491. the hardware:
  492.  
  493. Constant        Sampling Rate (samples/sec)
  494.  
  495. SND_RATE_CODEC  8012.821        (CODEC input)
  496. SND_RATE_LOW    22050.0 (low sampling rate output)
  497. SND_RATE_HIGH   44100.0 (high sampling rate output)
  498.  
  499. channelCount is the number of channels of sampled sound.
  500.  
  501.  
  502.  
  503.  
  504.  
  505. info
  506.  
  507. info is a NULL-terminated string that you can supply to provide a
  508. textual description of the sound.  The size of the info field is set
  509. when the structure is created and thereafter can't be enlarged.  It's
  510. at least four bytes long (even if it's unused).
  511.  
  512.  
  513.  
  514.  
  515.  
  516. Format Codes
  517.  
  518. A sound's format is represented as a positive 32-bit integer.  NeXT
  519. reserves the integers 0 through 255; you can define your own format
  520. and represent it with an integer greater than 255.  Most of the
  521. formats defined by NeXT describe the amplitude quantization of
  522. sampled sound data:
  523.  
  524. Value   Code    Format
  525.  
  526. 0       SND_FORMAT_UNSPECIFIED  unspecified format
  527. 1       SND_FORMAT_MULAW_8      8-bit mu-law samples
  528. 2       SND_FORMAT_LINEAR_8     8-bit linear samples
  529. 3       SND_FORMAT_LINEAR_16    16-bit linear samples
  530. 4       SND_FORMAT_LINEAR_24    24-bit linear samples
  531. 5       SND_FORMAT_LINEAR_32    32-bit linear samples
  532. 6       SND_FORMAT_FLOAT        floating-point samples
  533. 7       SND_FORMAT_DOUBLE       double-precision float samples
  534. 8       SND_FORMAT_INDIRECT     fragmented sampled data
  535. 9       SND_FORMAT_NESTED       ?
  536. 10      SND_FORMAT_DSP_CORE     DSP program
  537. 11      SND_FORMAT_DSP_DATA_8   8-bit fixed-point samples
  538. 12      SND_FORMAT_DSP_DATA_16  16-bit fixed-point samples
  539. 13      SND_FORMAT_DSP_DATA_24  24-bit fixed-point samples
  540. 14      SND_FORMAT_DSP_DATA_32  32-bit fixed-point samples
  541. 15      ?
  542. 16      SND_FORMAT_DISPLAY      non-audio display data
  543. 17      SND_FORMAT_MULAW_SQUELCH        ?
  544. 18      SND_FORMAT_EMPHASIZED   16-bit linear with emphasis
  545. 19      SND_FORMAT_COMPRESSED   16-bit linear with compression
  546. 20      SND_FORMAT_COMPRESSED_EMPHASIZED        A combination of the two above
  547. 21      SND_FORMAT_DSP_COMMANDS Music Kit DSP commands
  548. 22      SND_FORMAT_DSP_COMMANDS_SAMPLES         ?
  549.  
  550.  
  551. Most formats identify different sizes and types of
  552. sampled data.  Some deserve special note:
  553.  
  554.  
  555. --      SND_FORMAT_DSP_CORE format contains data that represents a
  556. loadable DSP core program.  Sounds in this format are required by the
  557. SNDBootDSP() and SNDRunDSP() functions.  You create a
  558. SND_FORMAT_DSP_CORE sound by reading a DSP load file (extension
  559. ".lod") with the SNDReadDSPfile() function.
  560.  
  561. --      SND_FORMAT_DSP_COMMANDS is used to distinguish sounds that
  562. contain DSP commands created by the Music Kit.  Sounds in this format
  563. can only be created through the Music Kit's Orchestra class, but can
  564. be played back through the SNDStartPlaying() function.
  565.  
  566. --      SND_FORMAT_DISPLAY format is used by the Sound Kit's
  567. SoundView class.  Such sounds can't be played.
  568.  
  569.  
  570. --      SND_FORMAT_INDIRECT indicates data that has become
  571. fragmented, as described in a separate section, below.
  572.  
  573.  
  574. --      SND_FORMAT_UNSPECIFIED is used for unrecognized formats.
  575.  
  576.  
  577.  
  578.  
  579.  
  580. Fragmented Sound Data
  581.  
  582. Sound data is usually stored in a contiguous block of memory.
  583. However, when sampled sound data is edited (such that a portion of
  584. the sound is deleted or a portion inserted), the data may become
  585. discontiguous, or fragmented.  Each fragment of data is given its own
  586. SNDSoundStruct header; thus, each fragment becomes a separate
  587. SNDSoundStruct structure.  The addresses of these new structures are
  588. collected into a contiguous, NULL-terminated block; the dataLocation
  589. field of the original SNDSoundStruct is set to the address of this
  590. block, while the original format, sampling rate, and channel count
  591. are copied into the new SNDSoundStructs.
  592.  
  593.  
  594. Fragmentation serves one purpose:  It avoids the high cost of moving
  595. data when the sound is edited.  Playback of a fragmented sound is
  596. transparent-you never need to know whether the sound is fragmented
  597. before playing it.  However, playback of a heavily fragmented sound
  598. is less efficient than that of a contiguous sound.  The
  599. SNDCompactSamples() C function can be used to compact fragmented
  600. sound data.
  601.  
  602. Sampled sound data is naturally unfragmented.  A sound that's freshly
  603. recorded or retrieved from a soundfile, the Mach-O segment, or the
  604. pasteboard won't be fragmented.  Keep in mind that only sampled data
  605. can become fragmented.
  606.  
  607.  
  608.  
  609. _________________________
  610. >From mentor.cc.purdue.edu!purdue!decwrl!ucbvax!ziploc!eps Wed Apr  4
  611. 23:56:23 EST 1990
  612. Article 5779 of comp.sys.next:
  613. Path: mentor.cc.purdue.edu!purdue!decwrl!ucbvax!ziploc!eps
  614. >From: eps@toaster.SFSU.EDU (Eric P. Scott)
  615. Newsgroups: comp.sys.next
  616. Subject: Re: Format of NeXT sndfile headers?
  617. Message-ID: <445@toaster.SFSU.EDU>
  618. Date: 31 Mar 90 21:36:17 GMT
  619. References: <14978@phoenix.Princeton.EDU>
  620. Reply-To: eps@cs.SFSU.EDU (Eric P. Scott)
  621. Organization: San Francisco State University
  622. Lines: 42
  623.  
  624. In article <14978@phoenix.Princeton.EDU>
  625.         bskendig@phoenix.Princeton.EDU (Brian Kendig) writes:
  626. >I'd like to take a program I have that converts Macintosh sound
  627. files
  628. >to NeXT sndfiles and polish it up a bit to go the other direction as
  629. >well.
  630.  
  631. Two people have already submitted programs that do this
  632. (Christopher Lane and Robert Hood); check the various
  633. NeXT archive sites.
  634.  
  635. >       Could someone please give me the format of a NeXT sndfile
  636. >header?
  637.  
  638. "big-endian"
  639.         0       1       2       3
  640.         +-------+-------+-------+-------+
  641. 0       | 0x2e  | 0x73  | 0x6e  | 0x64  |       "magic" number
  642.         +-------+-------+-------+-------+
  643. 4       |                               |       data location
  644.         +-------+-------+-------+-------+
  645. 8       |                               |       data size
  646.         +-------+-------+-------+-------+
  647. 12      |                               |       data format (enum)
  648.         +-------+-------+-------+-------+
  649. 16      |                               |       sampling rate (int)
  650.         +-------+-------+-------+-------+
  651. 20      |                               |       channel count
  652.         +-------+-------+-------+-------+
  653. 24      |       |       |       |       |       (optional) info
  654. string
  655.  
  656. 28 = minimum value for data location
  657.  
  658. data format values can be found in /usr/include/sound/soundstruct.h
  659.  
  660. Most common combinations:
  661.  
  662.          sampling  channel    data
  663.              rate    count  format
  664. voice file   8012        1       1 =  8-bit mu-law
  665. system beep 22050        2       3 = 16-bit linear
  666. CD-quality  44100        2       3 = 16-bit linear
  667.  
  668. ------------------------------------------------------------------------
  669. IFF/8SVX Format
  670. ---------------
  671.  
  672. Newsgroups: alt.binaries.sounds.d,alt.sex.sounds
  673. Subject: Format of the IFF header (Amiga sounds)
  674. Message-ID: <2509@tardis.Tymnet.COM>
  675. From: jms@tardis.Tymnet.COM (Joe Smith)
  676. Date: 23 Oct 91 23:54:38 GMT
  677. Followup-To: alt.binaries.sounds.d
  678. Organization: BT North America (Tymnet)
  679.  
  680. The first 12 bytes of an IFF file are used to distinguish between an Amiga
  681. picture (FORM-ILBM), an Amiga sound sample (FORM-8SVX), or other file
  682. conforming to the IFF specification.  The middle 4 bytes is the count of
  683. bytes that follow the "FORM" and byte count longwords.  (Numbers are stored
  684. in M68000 form, high order byte first.)
  685.  
  686.                 ------------------------------------------
  687.  
  688. FutureSound audio file, 15000 samples at 10.000KHz, file is 15048 bytes long.
  689.  
  690. 0000: 464F524D 00003AC0 38535658 56484452    FORM..:.8SVXVHDR
  691.       F O R M     15040 8 S V X  V H D R
  692. 0010: 00000014 00003A98 00000000 00000000    ......:.........
  693.             20    15000        0        0
  694. 0020: 27100100 00010000 424F4459 00003A98    '.......BODY..:.
  695.      10000 1 0    1.0   B O D Y     15000
  696.  
  697. 0000000..03 = "FORM", identifies this as an IFF format file.
  698. FORM+00..03 (ULONG) = number of bytes that follow.  (Unsigned long int.)
  699. FORM+03..07 = "8SVX", identifies this as an 8-bit sampled voice.
  700.  
  701. ????+00..03 = "VHDR", Voice8Header, describes the parameters for the BODY.
  702. VHDR+00..03 (ULONG) = number of bytes to follow.
  703. VHDR+04..07 (ULONG) = samples in the high octave 1-shot part.
  704. VHDR+08..0B (ULONG) = samples in the high octave repeat part.
  705. VHDR+0C..0F (ULONG) = samples per cycle in high octave (if repeating), else 0.
  706. VHDR+10..11 (UWORD) = samples per second.  (Unsigned 16-bit quantity.)
  707. VHDR+12     (UBYTE) = number of octaves of waveforms in sample.
  708. VHDR+13     (UBYTE) = data compression (0=none, 1=Fibonacci-delta encoding).
  709. VHDR+14..17 (FIXED) = volume.  (The number 65536 means 1.0 or full volume.)
  710.